﻿@model IEnumerable<GosWeb.Models.Db.Biont>

<fieldset>
    <legend>@ViewBag.ListTitle |共 @Model.Count() 个 | </legend>
    @if (Model.Count() == 0)
    {
     <p>无</p>
    }
    else
    {
    <table>
        <tr>
            <th>
            </th>
            <th>
                号码
            </th>
            <th>
                雌雄
            </th>
            <th>
                父
            </th>
            <th>
                母
            </th>
            <th>
                窝次
            </th>
            <th>
                生日
            </th>
            <th>
                地址
            </th>
            <th>
                血缘
            </th>
            <th>
                去向
            </th>
            <th>
                内部备注
            </th>  
            <th>
                公开备注
            </th>
        </tr>
        @foreach (var item in Model)
        {
            string geneStyle = "style =\"color:Green\"";
            var geneRatioString = item.GenesMidStr;
            if (string.IsNullOrWhiteSpace(geneRatioString))
            {
                geneStyle = "style = \"background-color:Red\"";
            }

            string sexStyle = "style =\"color:Green\"";
            if (item.Sex != 0 && item.Sex != 1)
            {
                sexStyle = "style = \"background-color:Red\"";
            }
            <tr>
                <td>
                </td>
                <td>
                    @Html.ActionLink(item.BiontID, "Details", new { id = item.BiontID })
                </td>
                <td @Html.Raw(sexStyle)>
                    @item.SexStr
                </td>
                <td>
                    @if (string.IsNullOrWhiteSpace(item.FatherID) == false)
                    {
                       @Html.ActionLink(item.FatherID, "Details", new { id = item.FatherID });
                    }
                    else
                    {

                    }

                </td>
                <td>
                @if (string.IsNullOrWhiteSpace(item.MotherID) == false)
                {
                    @Html.ActionLink(item.MotherID, "Details", new { id = item.MotherID });
                }
                </td>
                <td>
                    @item.NestNumber
                </td>
                <td>
                    @String.Format("{0:D}", item.Birthday)
                </td>
                <td>
                    @item.Address
                </td>
                <td @Html.Raw(geneStyle)>
                   @geneRatioString
                </td>
                <td>
                    @item.FromToStr
                </td>
                <td>
                    @GosWeb.Biz.Utilities.GetSortSummary(item.PrivInfo, 20)
                </td>
                <td>
                    @GosWeb.Biz.Utilities.GetSortSummary(item.PubInfo, 20)
                </td>
            </tr>
        }
    </table>
    }
</fieldset>
